﻿using AdverseEventReportSystem.BLL.SchedulingSystem;
using AdverseEventReportSystem.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AdverseEventReportSystem.BLL.Scheduling
{
    public class ScheduleRemarkManager
    {
        /// <summary>
        /// 保存单个排班备注
        /// </summary>
        /// <param name="schedulingRemark"></param>
        /// <returns></returns>
        public static OperateResult SaveSchedulingRemark(SchedulingRemark schedulingRemark)
        {
            OperateResult resultInfo = new OperateResult();
            try
            {
                SchedulingSystemSoapClient service = new SchedulingSystemSoapClient();
                ResultHelperOfBoolean result = service.SaveSchedulingRemark(schedulingRemark);
                if (result.S)
                {
                    resultInfo.Result = 1;
                    resultInfo.Body = result.M;
                }
                else
                {
                    resultInfo.Result = 0;
                    resultInfo.Body = result.M;
                }
            }
            catch (Exception ex)
            {
                resultInfo.Result = 0;
                resultInfo.Body = ex.Message;
            }
            return resultInfo;
        }

        /// <summary>
        /// 获取单个排班备注
        /// </summary>
        /// <param name="departmentCode">病区编码</param>
        /// <returns></returns>
        public static OperateResult GetSchedulingRemark(string departmentCode)
        {
            OperateResult resultInfo = new OperateResult();
            try
            {
                SchedulingSystemSoapClient service = new SchedulingSystemSoapClient();
                ResultHelperOfSchedulingRemark result = service.GetSchedulingRemark(departmentCode);
                if (result.S)
                {
                    resultInfo.Result = 1;
                    resultInfo.Body = result.D;
                }
                else
                {
                    resultInfo.Result = 0;
                    resultInfo.Body = result.M;
                }
            }
            catch (Exception ex)
            {
                resultInfo.Result = 0;
                resultInfo.Body = ex.Message;
            }
            return resultInfo;
        }
    }
}
